﻿using Microsoft.Practices.Prism.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace FridgeManagerApp
{
    [DataContract]
    public class WDevice : NotificationObject
    {
        private int deviceUID;
        private String deviceName;
        private int deviceTypeUID;
        private String position;
        private float devicePrice;
        private String dateOfManufacture;
        private String dateOfUse;
        private int serviceLife;

        [DataMember(Order = 0)]
        public int DeviceUID
        {
            get
            {
                return deviceUID;
            }
            set
            {
                deviceUID = value;
                RaisePropertyChanged("DeviceUID");
            }
        }

        [DataMember(Order = 1)]
        public String DeviceName
        {
            get
            {
                return deviceName;
            }
            set
            {
                deviceName = value;
                RaisePropertyChanged("DeviceName");
            }
        }

        [DataMember(Order = 2)]
        public int DeviceTypeUID
        {
            get
            {
                return deviceTypeUID;
            }
            set
            {
                deviceTypeUID = value;
                RaisePropertyChanged("DeviceTypeUID");
            }
        }

        [DataMember(Order = 3)]
        public String Position
        {
            get
            {
                return position;
            }
            set
            {
                position = value;
                RaisePropertyChanged("Position");
            }
        }

        [DataMember(Order = 4)]
        public float DevicePrice
        {
            get
            {
                return devicePrice;
            }
            set
            {
                devicePrice = value;
                RaisePropertyChanged("DevicePrice");
            }
        }

        [DataMember(Order = 5)]
        public String DateOfManufacture
        {
            get
            {
                return dateOfManufacture;
            }
            set
            {
                dateOfManufacture = value;
                RaisePropertyChanged("DateOfManufacture");
            }
        }

        [DataMember(Order = 6)]
        public String DateOfUse
        {
            get
            {
                return dateOfUse;
            }
            set
            {
                dateOfUse = value;
                RaisePropertyChanged("DateOfUse");
            }
        }

        [DataMember(Order = 7)]
        public int ServiceLife
        {
            get
            {
                return serviceLife;
            }
            set
            {
                serviceLife = value;
                RaisePropertyChanged("ServiceLife");
            }
        }

        public WDevice()
        {
            DeviceUID = -1;
            DeviceName = "";
            DeviceTypeUID = -1;
            Position = "";
            DevicePrice = -1;
            DateOfManufacture = "";
            DateOfUse = "";
            ServiceLife = -1;
        }

        public WDevice(LDevice p)
        {
            DeviceUID = p.DeviceUID;
            DeviceName = p.DeviceName;
            DeviceTypeUID = p.DeviceTypeUID;
            Position = p.Position;
            DevicePrice = p.DevicePrice;
            DateOfManufacture = p.DateOfManufacture;
            DateOfUse = p.DateOfUse;
            ServiceLife = p.ServiceLife;
        }
    }
}
